package com.cs.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Sam.Lee E-mail:lishanman2007@163.com
 * @version Created：Aug 25, 2011 9:13:29 AM
 */
public class Subject {
	private List<Observer> readers = new ArrayList<Observer>();

	public void attachReader(Observer reader) {
		readers.add(reader);
	}

	public void removeReader(Observer reader) {
		readers.remove(reader);
	}

	public void notifyReaders(String content) {
		for (Observer reader : readers) {
			reader.update(content);
		}
	}
}
